1. Technical Field
The present invention relates to a computer system that enables a plurality of virtual machines
2. Background Art
As shown in FIG. 17, there is a conventionally-known computer system in which a plurality of (two in FIG. 17) virtual machines 310 and 311 managed by different operating systems (OS11 and OS12 in FIG. 17) are enabled as a result of one central processing unit (CPU) 300 executing a program stored in memory 302 (see, for example, Patent Literature 1 and Patent Literature 2). Note that FIG. 17 conceptually illustrates the virtual machines 310 and 311, etc. being enabled as a result of the CPU 300 executing the program stored in the memory 302. The virtual machines 310 and 311, etc. are not the actual constituent elements of the memory 302.
This type of computer system includes a hypervisor 312 composed of virtual CPUs (virtual processing units) 343 and 344 that respectively execute the virtual machines 310 and 311. The hypervisor 312 may have a function of allocating the CPU 300 to the virtual CPUs 343 and 344 alternately. The hypervisor 312 is also referred to as a virtual machine (VM) monitor or a hardware partition control unit.
In this computer system, the virtual machine 310 executes tasks T11 and T12, and the virtual machine 311 executes tasks T21 and T22. The hypervisor 312 manages a time schedule according to which the CPU 300 executes each of the virtual machines 310 and 311. The hypervisor 312, also, is enabled as a result of the CPU 300 executing a corresponding program stored in the memory 302.
Incidentally, the computer system illustrated in FIG. 17 performs processing for advancing the values counted by system timers ST1 and ST2 in a predetermined cycle (timer processing). Note, the system timers ST1 and ST2 respectively define the internal times of the operating systems OS11 and OS12. This timer processing is performed to advance the internal times of the operating systems OS11 and OS12. More specifically, this timer processing is carried out by the CPU 300 executing an interrupt handler (tick handler) in accordance with an interrupt request (tick interrupt). The interrupt request is issued in a predetermine cycle (e.g., every 5 ms or 10 ms in the case of a UNIX™ operating system) by an interrupt controller 306 connected to a hardware timer 307. Note that each of the hardware timer 307 and the interrupt controller 306 is configured with hardware different from the CPU 300 and the like.
The above timer processing can be performed in a conventional method whereby, each time the interrupt controller 306 issues a tick interrupt to the virtual machine 310 while the virtual machine 311 is operating but the virtual machine 310 is not, the CPU 300 stops the computer processing of the virtual machine 311 so as to perform the timer processing of the virtual machine 310. That is to say, this method temporarily switches from the virtual machine 311 to the virtual machine 310 only to perform the timer processing.
However, upon switching from the virtual machine 311 to the virtual machine 310, this method temporarily relocates data (e.g., register information) used by the virtual CPU 344 that executes the virtual machine 311 within the memory 302—i.e., moves the data from a CPU working area to a save area different from the CPU working area. Thereafter, another data used by the virtual CPU 343 that executes the virtual machine 310 is loaded to the CPU working area. Note, the CPU working area is an area where the register information or the like for enabling a virtual CPU is stored. However, the overhead increases as a result of (i) relocating data from the CPU working area to the save area in the memory 302, and (ii) loading another data to the CPU working area. This could lower the processing efficiency of the entire computer system.
To address the above issue, there is a conventional method for performing the timer processing at a certain timing (see Patent Literature 1). More specifically, in a computer system that enables two virtual machines (first virtual machine and second virtual machine), this method (i) does not perform the timer processing of the first virtual machine when the first virtual machine is not operating, even if a tick interrupt is issued to the first virtual machine by an interrupt request issuing unit that is configured with hardware different from the CPU and the like, and (ii) performs the timer processing of the first virtual machine upon next execution of the first virtual machine (upon switching from the second virtual machine to the first virtual machine). Upon switching from the second virtual machine to the first virtual machine, this method advances the value counted by a system timer of the first virtual machine by a period of time for which the first virtual machine was not operating.
This method does not switch from the virtual machine 311 to the virtual machine 310 when the virtual machine 310 is not operating, even if a tick interrupt is issued to the virtual machine 310. Hence, using this method makes it possible to decrease the overhead associated with the switching between the virtual machines 310 and 311.
In addition, there is also a conventional virtual machine system that alternately executes a plurality of operating systems (in other words, executes a plurality of virtual machines managed by different operating systems alternately) (see Patent Literature 2). If an interrupt request issuing unit issues a tick interrupt to one of the operating systems that is not operating, this virtual machine system performs timer processing associated with the issued tick interrupt at once during an operating period that is next allocated to this operating system.
In this virtual machine system, if the interrupt request issuing unit issues a tick interrupt to one of the operating systems that is not being executed, the hypervisor (hardware partition control unit) only counts the number of times the tick interrupt is issued.
Then, the hypervisor adds (i) the number of times the tick interrupt was issued while this operating system was not operating and (ii) the number of times the tick interrupt will be issued during the operating period that is next allocated to this operating system. The hypervisor divides the operating period that is next allocated to this operating system by a value obtained by the above addition, and regards a value obtained by the above division as a cycle in which new timer processing will be performed.
This virtual machine system, too, does not switch between operating systems when a tick interrupt is issued to one of the operating systems that is not being executed. Accordingly, this virtual machine system can also decrease the overhead associated with the switching between the operating systems.